package com.liuqi.loggers.core.converters;

import com.liuqi.loggers.core.Converter;
import com.liuqi.loggers.core.LoggerEvent;
import java.text.SimpleDateFormat;

/**
 * converter %date
 *
 * @author liuqi
 * @date 2024/11/5 16:53
 **/
public class DateConverter implements Converter {

    final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

    @Override
    public String convert(LoggerEvent event) {
        return sdf.format(event.getTimestamp());
    }

    @Override
    public String convert0(LoggerEvent event) {
        return sdf.format(event.getTimestamp());
    }

    @Override
    public String name() {
        return "timestamp";
    }

}
